#include<stdio.h> 
#include<bits/stdc++.h> 
using namespace std;
int n,q;
struct tt{
	int z,x;
}a[8005];
int cmp(tt x,tt y){
	return x.x<y.x;
}
int cr(tt x,tt y){
	if(x.z!=y.z)return x.z<y.z;
	else return x.x<y.x;
}
/*void pUt(){
	cout<<"-----------------------\n";
	for(int i=1;i<=n;i++){
		cout<<a[i].z<<" ";
	}
	cout<<endl;
	for(int i=1;i<=n;i++){
		cout<<a[i].x<<" ";
	}
	cout<<"\n-------------------------\n";
	return ;
} */
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>q;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i].z);
		a[i].x=i;
	}
	int ok=0;
	for(int i=1,x,v,y;i<=q;i++){
		scanf("%d",&y);
		if(y==1){
			scanf("%d%d",&x,&v);
			if(ok!=2){
				sort(a+1,a+n+1,cmp);
				ok=2;
			}
			a[x].z=v;
		}if(y==2){
			//pUt();
			if(ok==0){
				sort(a+1,a+n+1,cmp);
				ok=2;	
			}
			if(ok!=1){
				sort(a+1,a+n+1,cr);
				ok=1;
			}//pUt();
			scanf("%d",&x);
			for(int j=1;j<=n;j++){
				if(a[j].x==x){
					printf("%d\n",j);
					break;
				}
			}
		}
	}
	return 0;
}
